<template>
  <div class="listBox relative">
    <el-table height="100%" class="tabStyle1" :data="data">
      <el-table-column
        v-for="item in selectedHead.checkRow"
        :key="item"
        :label="item"
        :prop="item"
        align="center"
        width
      ></el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "List",
  props: {
    allData: {
      type: Array,
      required: true
    },
    selectedHead: {
      type: Object,
      required: true
    },
    index: {
      type: String,
      required: true
    },
    num: {
      type: Number,
      required: true
    }
  },
  data() {
    return {
      data: this.allData,
      i: Number(this.index[4]) - 1,
      numValue: this.index[0],
      deploy: []
      // selectedData: [],
    };
  },
  
  created() {
    let that = this;
    console.log(this.num);
    console.log(this.selectedHead.UpData[this.num][this.i]);
    this.data=this.selectedHead.UpData[this.num][this.i]
    let unit = {};
    if (that.numValue != "n") {
      for (var i = 0, len = that.data.length; i < len; i += 1) {
        var arr = [];
        for (let allKey in that.data[i]) {
          that.selectedHead.checkRow.map(item => {
            if (allKey == item) {
              arr[item] = that.data[i][allKey];
            }
          });
        }
        // that.data = [];
        that.data[i] = arr;
      }
    }

    // console.log(that.selectedData)
  },

  methods: {}
};
</script>

<style scoped>
.settingBox {
  width: 160px;
  height: 60px;
  bottom: 10px;
  left: 10px;
  top: 50%;
  margin-top: -30px;
  text-align: center;
  line-height: 30px;
  border-radius: 5px;
  background: #dcdcdc;
}
.settingBox p {
  width: 60px;
}
.settingBox a {
  display: block;
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-size: 14px;
  color: #000;
  background: #fff;
  border-radius: 2px;
}
.icon {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  color: #aaa;
}
</style>



